<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <link rel="stylesheet" href="/static/css/common/reset.css" />
    <link rel="stylesheet" href="/static/css/associate.css" />
    <link rel="stylesheet" href="/static/css/ng-pagination.min.css" />
    <title>宾果高校</title>
</head>
<body>
    <div class="associate">
        <div id="divHeader"></div>
        <section class="assoc-content container clearfix">
            <div class="assoc-c-left fl">
                <div class="assoc-cl-top">
                    <img src="/static/images/community1.png" />
                </div>
                <div id="divNavigation"></div>
            </div>
            <div class="assoc-c-right fr" ng-app="myApp">
                <div class="assoc-cr-underActivity">
                    <ul class="assoc-cru-title clearfix" id="contract-cru-title">
                        <li class="active">进行中</li>
                        <li>历史活动</li>
                    </ul>
                    <div class="assoc-cru-content mt10" ng-controller="contractCtrl">
                        <div class="assoc-cru-list mt5 borderbtm clearfix">
                            <p class="">项目名称</p>
                            <p>合同确定时间</p>
                            <!--<p>企业付款</p>
                            <p>社团首款</p>-->
                            <p>赞助金总额</p>
                            <p>查看详情</p>
                            <p>合作企业</p>
                        </div>
                        <ul class="assoc-cruc-tab">
                            <li class="assoc-cru-list clearfix" ng-repeat="x in names">
                                <p>{{x.ProjectName}}</p>
                                <p>{{x.SignDate | date:'yyyy-MM-dd'}}</p>
                                <!--<p>已付款</p>
                                <p>已查收</p>-->
                                <p>{{x.Amount}}</p>
                                <p><a href="contractDetail.html?id={{x.ContractID}}" class="assoc-crul-check">点击查看</a></p>
                                <p>{{x.ContractorName}}</p>
                            </li>
                        </ul>
                        <div class="page">
                            <div class="center">
                                <pager page-count="pageCount" current-page="currentPage" on-page-change="onPageChange()" first-text="首页" next-text="下一页" prev-text="上一页" last-text="尾页"></pager>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>
    </div>
    <div id="divFooter"></div>
</body>
</html>

<script type="text/javascript" src="/static/js/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="/static/js/common.js"></script>
<script type="text/javascript" src="/static/js/angular.min.js"></script>
<script type="text/javascript" src="/static/js/ng-pagination.min.js"></script>
<script>

    $("#divHeader").load("/wuc/header.html");
    $("#divFooter").load("/wuc/footer.html");
    $("#divNavigation").load("/wuc/navigation.html");

    var values = {};
    values.Limit = 10;
    values.Start = 1;
    values.Status = "Effective";

    common.CreatePagingCtrl({ name: 'contractCtrl', limit: 10, pageChanged: ChangePage });

    function AfterCompleted(ctx) {
        if (ctx == null) {
            common.alertMessage("无数据.");
            return;
        }

        var ele = document.querySelector("[ng-controller=contractCtrl]");

        angular.element(ele).scope().update(ctx);
    }

    common.commonAjax({ type: 'Post', url: '/api/project/ListContractByStatus', data: values, sMethod: AfterCompleted });

    function ChangePage($scope) {

        values.Start = $scope.currentPage;

        common.commonAjax({ type: 'Post', url: '/api/project/ListContractByStatus', data: values, sMethod: AfterCompleted });
    }

    $("#contract-cru-title li").on('click', function (e) {
        var self = $(this);
        var index = $(this).index();
        self.siblings().removeClass('active');
        self.addClass('active');
        if (index == 0) {
            values.Status = "Effective";
            values.Start = 1;
            common.commonAjax({ type: 'Post', url: '/api/project/ListContractByStatus', data: values, sMethod: AfterCompleted });
        }
        else {
            values.Status = "Closed";
            values.Start = 1;
            common.commonAjax({ type: 'Post', url: '/api/project/ListContractByStatus', data: values, sMethod: AfterCompleted });
        }
    });

</script>

